package com.studyweb.pojo.entity;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 试卷测验结果实体类
 */
public class PaperResult {
    private Long id;
    private Long userId;
    private Long paperId;
    private Integer score;
    private Integer totalScore;
    private Integer correctCount;
    private Integer wrongCount;
    private Integer unansweredCount;
    private Integer timeSpent; // 答题时间(秒)
    private LocalDateTime startTime;
    private LocalDateTime endTime;
    private LocalDateTime createTime;
    private Map<Long, Object> userAnswers; // 用户答案，key为题目ID，value为用户答案
    private String scoringMethod; // 计分方式: "auto" 表示系统自动计分, "custom" 表示使用自定义分值配置
    private String scoringDescription; // 计分说明: 例如 "系统默认计分（每题1分）" 或 "2024国考行测分值配置"

    // 构造函数
    public PaperResult() {}

    public PaperResult(Long userId, Long paperId, Integer score, Integer totalScore, 
                      Integer correctCount, Integer wrongCount, Integer unansweredCount, 
                      Integer timeSpent, LocalDateTime startTime, LocalDateTime endTime) {
        this.userId = userId;
        this.paperId = paperId;
        this.score = score;
        this.totalScore = totalScore;
        this.correctCount = correctCount;
        this.wrongCount = wrongCount;
        this.unansweredCount = unansweredCount;
        this.timeSpent = timeSpent;
        this.startTime = startTime;
        this.endTime = endTime;
        this.createTime = LocalDateTime.now();
        this.scoringMethod = "auto"; // 默认为系统自动计分
        this.scoringDescription = "系统默认计分（每题1分）";
    }

    // Getter和Setter方法
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getPaperId() {
        return paperId;
    }

    public void setPaperId(Long paperId) {
        this.paperId = paperId;
    }

    public Integer getScore() {
        return score;
    }

    public void setScore(Integer score) {
        this.score = score;
    }

    public Integer getTotalScore() {
        return totalScore;
    }

    public void setTotalScore(Integer totalScore) {
        this.totalScore = totalScore;
    }

    public Integer getCorrectCount() {
        return correctCount;
    }

    public void setCorrectCount(Integer correctCount) {
        this.correctCount = correctCount;
    }

    public Integer getWrongCount() {
        return wrongCount;
    }

    public void setWrongCount(Integer wrongCount) {
        this.wrongCount = wrongCount;
    }

    public Integer getUnansweredCount() {
        return unansweredCount;
    }

    public void setUnansweredCount(Integer unansweredCount) {
        this.unansweredCount = unansweredCount;
    }

    public Integer getTimeSpent() {
        return timeSpent;
    }

    public void setTimeSpent(Integer timeSpent) {
        this.timeSpent = timeSpent;
    }

    public LocalDateTime getStartTime() {
        return startTime;
    }

    public void setStartTime(LocalDateTime startTime) {
        this.startTime = startTime;
    }

    public LocalDateTime getEndTime() {
        return endTime;
    }

    public void setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public Map<Long, Object> getUserAnswers() {
        return userAnswers;
    }

    public void setUserAnswers(Map<Long, Object> userAnswers) {
        this.userAnswers = userAnswers;
    }

    public String getScoringMethod() {
        return scoringMethod;
    }

    public void setScoringMethod(String scoringMethod) {
        this.scoringMethod = scoringMethod;
    }

    public String getScoringDescription() {
        return scoringDescription;
    }

    public void setScoringDescription(String scoringDescription) {
        this.scoringDescription = scoringDescription;
    }

    @Override
    public String toString() {
        return "PaperResult{" +
                "id=" + id +
                ", userId=" + userId +
                ", paperId=" + paperId +
                ", score=" + score +
                ", totalScore=" + totalScore +
                ", correctCount=" + correctCount +
                ", wrongCount=" + wrongCount +
                ", unansweredCount=" + unansweredCount +
                ", timeSpent=" + timeSpent +
                ", startTime=" + startTime +
                ", endTime=" + endTime +
                ", createTime=" + createTime +
                ", userAnswers=" + userAnswers +
                ", scoringMethod='" + scoringMethod + '\'' +
                ", scoringDescription='" + scoringDescription + '\'' +
                '}';
    }
}